package com.unicom.office.var;

import com.unicom.office.dataitem.DataItem;
import com.unicom.office.dataitem.NumberDataItem;
import com.unicom.office.type.NumberTypeItem;
import com.unicom.office.type.TypeItem;

public class NumberVarItem extends VarItem {
    //public static NumberVarItem INSTANCE = new NumberVarItem("number_var_item");

    public TypeItem getTypeItem() {
        return NumberTypeItem.INSTANCE;
    }

    public NumberVarItem(String name) {
        super(name);
    }

    public Object getFormatedValue(Object value) {
        if(value instanceof String) {
            return Double.valueOf(value.toString());
        }
        return value;
    }

    public DataItem createDataItem(Object value) {
        return new NumberDataItem(value, this);
    }
}
